/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Procesos;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author USER
 */
public class LectorDatos {

    public ArrayList LeerArchivoTxt(int oOpcion, String nombre) throws Exception {

        File oFile = null;
        FileReader oFileReader = null;
        BufferedReader oBufferedReader = null;

        Conexion oConexion = null;
        ArrayList oArrayList = null;

        String strLinea = null;

        try {

            oConexion = new Conexion();
            oFile = new File(oConexion.oTipoArchivo(oOpcion) + nombre + ".txt");
            oFileReader = new FileReader(oFile);
            oBufferedReader = new BufferedReader(oFileReader);

            oArrayList = new ArrayList();
            while ((strLinea = oBufferedReader.readLine()) != null) {
                oArrayList.add(strLinea.trim());
            }

            oFileReader.close();

        } finally {
            oFile = null;
            oFileReader = null;
            oBufferedReader = null;
            oConexion = null;
            strLinea = null;
            if (oFileReader != null) {
                oFileReader.close();
            }
        }

        return oArrayList;

    }
}
